import {Dimensions, PixelRatio, Platform} from 'react-native';

let {height, width} = Dimensions.get('window');
let isIOS = (Platform.OS === 'ios');
let isIPhoneX = isIOS && (height === 812 || height === 896 || height == 780 || height == 844 || height == 926);
let isAndroid = (Platform.OS === 'android');
//iPhone X底部安全区域高度
let BOTTOM_SAFE_AREA_HEIGHT = 34;
//状态栏高度
let STATUS_BAR_HEIGHT = isIPhoneX ? 44 : isIOS ? 20 : 0;
//导航栏高度
let NAVIGATION_BAR_HEIGHT = isIOS ? 44 : 45;
//状态栏高度+导航栏高度
let STATUS_NAVIGATION_BAR_HEIGHT = STATUS_BAR_HEIGHT + NAVIGATION_BAR_HEIGHT;
//TabBar高度
let TAB_BAR_HEIGHT = isIPhoneX ? 83 : 49;
//吸底按钮高度
let BOTTOM_BUTTON_CONTINER_HEIGHT = (10 + 40 +(isIPhoneX?BOTTOM_SAFE_AREA_HEIGHT:10));
let BOTTOM_BUTTON_HEIGHT = 40;

let designW = 375;
let designH = 667;
let designRateW = width/designW;
let designRateH = height/designH;

export function setDesignSize(w,h) {
	designW = w;
	designH = h;
}

export {designRateW,designRateH}

let Device = {
	SCREEN_WIDTH:width,
	SCREEN_HEIGHT:height,
	isIOS:isIOS,
	isIPhoneX:isIPhoneX,
	isAndroid:isAndroid,
	PixelRatio:PixelRatio.get(), ///屏幕分辨率
	BOTTOM_SAFE_AREA_HEIGHT:BOTTOM_SAFE_AREA_HEIGHT,
	STATUS_BAR_HEIGHT:STATUS_BAR_HEIGHT,
	NAVIGATION_BAR_HEIGHT:NAVIGATION_BAR_HEIGHT,
	STATUS_NAVIGATION_BAR_HEIGHT:STATUS_NAVIGATION_BAR_HEIGHT,
	TAB_BAR_HEIGHT:TAB_BAR_HEIGHT,
	BOTTOM_BUTTON_CONTINER_HEIGHT:BOTTOM_BUTTON_CONTINER_HEIGHT,
	BOTTOM_BUTTON_HEIGHT:BOTTOM_BUTTON_HEIGHT
}

export default Device;




